From 4ad30ecb687406f3afabac1bf85fede0544179d3 Mon Sep 17 00:00:00 2001 From: Mike Baker Date: Mon, 17 Apr 2006 19:19:58 +0000 Subject: [PATCH] add mini_fo patches to mount_root and firstboot SVN-Revision: 3667 --- .../package/base-files/default/bin/firstboot | 21 ++++++++++++++----- .../base-files/default/sbin/mount_root | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/openwrt/package/base-files/default/bin/firstboot b/openwrt/package/base-files/default/bin/firstboot index 44441b0ec0..46106e0e44 100755 --- a/openwrt/package/base-files/default/bin/firstboot +++ b/openwrt/package/base-files/default/bin/firstboot @@ -42,15 +42,25 @@ pivot() { # } mountdp() { # - dev=$1; mnt=$2; shift 2; opt=$* + dev=$1; mnt=$2; shift 2; opt=$* mount $dev $mnt $opt dupe $mnt $rom pivot $mnt /rom } +fopivot() { # + root=$1 + { + mount -t mini_fo -o base=/,sto=$1 none /mnt 2>&- && root=/mnt + } || { + [ "$3" = "1" ] && mount -o bind $1 $1 && dupe $1 $rom + } + pivot $root $2 +} + ramoverlay() { mkdir -p /tmp/root - mountdp /tmp/root /mnt -o bind + fopivot /tmp/root /rom 1 } [ "${0##*/}" = "firstboot" ] && { @@ -62,8 +72,8 @@ ramoverlay() { [ "$1" = "switch2jffs" ] && { mtd erase OpenWrt - mount -o remount,ro none / # try to avoid fs changing while copying - mount -o bind / /mnt + mount -o remount,ro none / 2>&- # try to avoid fs changing while copying + mount -o bind /tmp/root /mnt mount /dev/mtdblock/4 /rom/jffs -t jffs2 echo -n "copying files ... " cp -a /mnt/* /rom/jffs @@ -71,7 +81,8 @@ ramoverlay() { echo "done" pivot /rom /mnt mount -o move /mnt /tmp/root - pivot /jffs /rom + fopivot /jffs /rom + umount /tmp/root 2>&- jffs2root --clean exit 0 } diff --git a/openwrt/package/base-files/default/sbin/mount_root b/openwrt/package/base-files/default/sbin/mount_root index 48a9553009..b876907ee9 100755 --- a/openwrt/package/base-files/default/sbin/mount_root +++ b/openwrt/package/base-files/default/sbin/mount_root @@ -24,7 +24,7 @@ if [ "$1" != "failsafe" -a "$(nvram get no_root_swap)" != 1 ]; then [ $? != 0 ] && { echo "switching to jffs2" mount /dev/mtdblock/4 /jffs -t jffs2 - pivot /jffs /rom + fopivot /jffs /rom } || { echo "jffs2 unusable; using ramdisk" ramoverlay -- 2.30.2